<template>
  <div class="zh-navbar">
    <div class="zh-navbar-inner">
      <div class="left" @click="routerBack">
        <i class="iconfont icon-arrow-right-copy"></i>
      </div>
      <div class="content">
        {{ content }}
      </div>
      <div class="right" v-if="isRight">{{ right }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'NavBar',
  props: {
    content: {
      type: String,
      default: ''
    },
    isRight: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      right: '暂定'
    }
  },
  methods: {
    routerBack () {
      if (this.$route.name === 'person') {
        this.$router.push({ name: 'Wode' })
      } else {
        this.$router.back(-1)
      }
    }
  }
}
</script>

<style lang="less" scoped>
.zh-navbar {
  background: #fff;
  width: 100%;
  position: fixed;
  top: 0px;
  z-index: 99;
  .zh-navbar-inner {
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    height: 50px;
    line-height: 50px;
    position: relative;
    .left {
      width: 30px;
      position: absolute;
      left: 10px;
      top: 45%;
      transform: translateY(-50%);
    }
    .content {
      flex: 1;
      text-align: center;
      font-size: 16px;
    }
    .right {
      width: 50px;
    }
  }
}
</style>
